﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mogre;

namespace WastedMechanics
{
    public class AnimStatePart
    {
        public AnimationState AnimationState;
        public string Name;        
        public int AffectedGroupsCount;

        public float SavedTimePosition;
        public float SavedWeight;
        public bool SavedEnabled;
        public bool SavedLoop;

        public AnimStatePart(AnimationState state)
        {
            AnimationState = state;
            Name = state.AnimationName;
        }

        public void AddTime(float time)
        {
            AnimationState.AddTime(time);            
        }

        public void RestoreParams()
        {
            AnimationState.Enabled = SavedEnabled;
            AnimationState.Weight = SavedWeight;
            AnimationState.TimePosition = SavedTimePosition;
            AnimationState.Loop = SavedLoop;                        
        }

        public void SaveParams()
        {
            SavedTimePosition = AnimationState.TimePosition;
            SavedWeight = AnimationState.Weight;
            SavedEnabled = AnimationState.Enabled;
            SavedLoop = AnimationState.Loop;
        }

        public float TimePosition
        {
            get
            {
                return AnimationState.TimePosition;
            }
            set
            {
                AnimationState.TimePosition = value;
            }
        }

        public float Weight
        {
            get
            {
                return AnimationState.Weight;
            }
            set
            {
                AnimationState.Weight = value;
            }
        }

        public float Length
        {
            get
            {
                return AnimationState.Length;
            }
        }

        public bool Loop
        {
            get
            {
                return AnimationState.Loop;
            }
            set
            {
                AnimationState.Loop = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return AnimationState.Enabled;
            }
            set
            {
                AnimationState.Enabled = value;
            }
        }
    }
}
